package com.mitlab.dev.draw.mapper;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.mitlab.dev.draw.samleClass.Person;

public class PersonService {
	public Person loadPerson(Person person) {
		System.out.println(person.getName());
		return null;
	}
	
	public static void main(String[] args) throws Exception {
		Person $1 = new Person();
		$1.setEnabled(true);
		$1.setName("name$1");
		new PersonService().extractPerson($1);
	}

	private void extractPerson(Person $1) throws IllegalAccessException, InvocationTargetException {
		Person $2 = new Person();
		$2.setName($1.getName());
		Method[] methods = PersonService.class.getMethods();
		java.lang.reflect.Method invoke = null;
		for (Method m: methods) {
			if ("loadPerson".equals(m.getName())) {
				invoke = m;
				break;
			}
		}
		Person $3 = (Person) invoke.invoke(this, $2);
	}
	
	public Method getMethod(Class<?> clazz,String methodName){
		Method[] methods = clazz.getMethods();
		java.lang.reflect.Method invoke = null;
		for (Method m: methods) {
			if (methodName.equals(m.getName())) {
				invoke = m;
				break;
			}
	
	}
		return invoke;
}
	
}
